<?php

Raise::load('control.GoogleAnalytics');
Raise::load('core.RaiseDomParser');

/**
 * TestControlGoogleAnalytics class
 * Testing unit of 'phpraise/control/GoogleAnalytics.php'
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestControlGoogleAnalytics extends RaiseTest {

    public static function testClass(){
        self::assertClassExists('GoogleAnalytics');
        self::assertClassExtends('GoogleAnalytics', 'RaiseUIControl');
        $ga = new GoogleAnalytics('sampleCode');

        $tree = RaiseDomParser::parseString($ga->output());
        self::assertObjectClass($tree, 'RaiseDomTreeNode');
        self::assertObjectClass($tree->children()->get(0)->tag(), 'RaiseHtmlTag');
        self::assertStrictEqual($tree->children()->get(0)->tag()->tagName(), 'script');
        self::assertStrictEqual($tree->children()->count(), 1);
    }
    
}

